package WebServices;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPEnvelope;
import java.io.ByteArrayInputStream;
import java.io.InputStream;

public class TestAlex
{
	public static String msg = "<?xml version='1.0'?>" +
		"<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://web.cbr.ru/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + 
		"<SOAP-ENV:Body>" +
		"<getHospitals/>" +
		"</SOAP-ENV:Body>" +
		"</SOAP-ENV:Envelope>";

   public static void main(String [] args) 
   {
	   System.out.println( new TestAlex().takeAll() );
   }
   
   String takeAll()
   {
	   String sRes = ""; 
	   String sEndPoint;
	   
       try {
    	   
    	   
           sEndPoint = "http://192.168.0.101/ksnet2/HospitalService/server.wsdl";
           
           //	sEndPoint = "http://192.168.0.102/scripts/SOAP/test.wsdl";
     
           Service  srvcAux = new Service();
           InputStream input = new ByteArrayInputStream( msg.getBytes() );
           
           Call callAux = ( Call )srvcAux.createCall();
           SOAPEnvelope env = new SOAPEnvelope( input );

           callAux.setTargetEndpointAddress( new java.net.URL( sEndPoint ) );

           callAux.setUseSOAPAction( true );
           callAux.setSOAPActionURI( "urn:xmethods-delayed-quotes#getHospitals" );
           //	callAux.setSOAPActionURI( "OmodInfoXML" );
           //	callAux.setSOAPActionURI( "getQuote" );

           sRes = callAux.invoke( env ).toString();
           
           //	System.out.println( callAux.getSOAPActionURI() );

           //	System.out.println( "got '" + sRes + "'");
           
       } catch (Exception e) {
           System.err.println(e.toString());
       }
       return sRes;
   }
}
